package com.zeronx.controller;

import com.zeronx.entity.DateClass;
import com.zeronx.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.SimpleDateFormat;

/**
 * @author zeronx on 2017/4/19 21:34.
 * @version 1.0
 */
@Controller
@RequestMapping("/date")
public class DateFmtController {

    @RequestMapping("/fmt")
    @ResponseBody
    public Object dateFmt(User user) {
        System.out.println(user);
        DateClass dateClass = user.getDateClasses().get(0);
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dateClass.getDate()));

        return new Integer(2);
    }
}
